<template>
    <div class="iconButton" @click="nav">
        <i :class="icon"></i>
        <p>{{title}}</p>
    </div>
</template>
<script>
export default {
    name: 'iconButton',
    props: {
        icon: {
            type: String
        },
        title: {
            type: String
        },
        url: {
            type: String
        },
        code: {
            type: [String, Number]
        }
    },
    methods: {
        nav() {
            if (this.code) {
                this.$emit('click', this.code)
                return;
            }
            if (this.url)
                window.open(this.url, '_blank');
        }
    }
}
</script>

